class MyLogger {
    settings = require ("../settings");
    log4js = require('log4js');
    logger:any = {}
    constructor(){
        this.log4js.configure(this.settings.log4js.configure);
        for (let key in this.settings.log4js.configure.categories) {
            this.logger[key] = this.log4js.getLogger(key);
        }
    }

    get(categories:string){
        if(typeof (this.settings.log4js.configure.categories[categories]) == "undefined")
            return this.logger["default"];
        return this.logger[categories];
    }
    use(app:any){
        for (let key in this.settings.log4js.configure.categories) {
            app.use(this.log4js.connectLogger(this.logger[key]));
        }
    }
}

module.exports = MyLogger;